package com.ddwl.goods.controller;

import com.ddwl.common.controller.BaseController;
import com.ddwl.goods.service.ActivityService;
import com.ddwl.schema.bo.base.PageBo;
import com.ddwl.schema.bo.goods.ActivityBo;
import com.ddwl.schema.vo.base.PageVo;
import com.ddwl.schema.vo.base.RestVo;
import com.ddwl.schema.vo.goods.ActivityListVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("activity")
@Api(tags = "活动类")
public class ActivityController extends BaseController {


    @Autowired
    public ActivityService activityService;

    @PostMapping("list")
    @ApiOperation("活动列表")
    public RestVo<PageVo<ActivityListVo>> activityList(@RequestBody PageBo<ActivityBo> pageBo) {
        return RestVo.ok(activityService.activityList(pageBo));
    }

    @GetMapping("shelf")
    @ApiOperation("活动上下架")
    public RestVo<String> shelf(@RequestParam("activityId") String activityId, @RequestParam("activityStatus") Integer activityStatus) {
        return RestVo.ok(activityService.shelf(activityId, activityStatus));
    }
}
